[SQL] Geometric, getting x and y co-ordinates from point data type/ - Mailing list pgsql-sql

From Stuart Rison
Subject [SQL] Geometric, getting x and y co-ordinates from point data type/
Date
Msg-id v04020a04b37c33bdb616@[128.40.242.190]
Whole thread Raw
List pgsql-sql
Hi there,

Suppose you have a table:

id     pos
1    (0,5)
2    (-1,6)
3    (5.5,9.8)

Are there functions to get to the individual coords such that

SELECT id,x_coord(pos),y_coord(pos) FROM table;

gives

id    x_coord    y_coord
1    0    5
2    -1    6
3    5.5    9.8

Stuart.



+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street               |
| Tel. (0171) 878 4041    | London, W1P 8BT, UNITED KINGDOM.     |
| Fax. (0171) 878 4040    | stuart@ludwig.ucl.ac.uk              |
+-------------------------+--------------------------------------+


pgsql-sql by date:

Previous
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [SQL] Are PL/pgSQL calls atomic?
Next
From: "Mark Wright"
Date:
Subject: Re: [SQL] Are PL/pgSQL calls atomic?